package com.study.config;

import com.study.interceptor.AuthInterceptor;
import com.study.interceptor.LoginInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 拦截器配置
 *
 * @创建时间 2020/4/21 14:36
 */
@Slf4j
@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {

    @Autowired
    AuthInterceptor authInterceptor;

    @Autowired
    LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
     /*   registry.addInterceptor(authInterceptor).addPathPatterns("/**")
                .excludePathPatterns("/css/**", "/images/**", "/js/**", "/login.html");


        //TODO 购物车拦截器
        CarInterceptor carInterceptor = new CarInterceptor();
        registry.addInterceptor(carInterceptor).addPathPatterns("/**");*/


        //JSOUP测试 登录

        registry.addInterceptor(loginInterceptor).addPathPatterns("/jsoup/**")//
                .excludePathPatterns("/css/**", "/images/**", "/js/**", "/login.html");


    }
}
